<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>数据库管理</title>
<script type="text/javascript" src="/j-tool/jquery.js"></script>
<link href='/public/css/admins.css' rel='stylesheet' type='text/css'/>
<body>
	<div class='bread'>数据库管理</div>
	<div class="manageBox">
		<div class="formBox">
			<form method="post" name="psource" action="" onsubmit="return false;"> 
				<table class="searchBox">
					<tr>
						<td>HOST：</td><td><input type="text" name="dbhost" class="input-text" value="<!--{$smarty.const.DBHOST}-->"/></td>
					</tr>
					<tr>
						<td>账号：</td><td><input type="text" name="dbroot" class="input-text" value="<!--{$smarty.const.DBROOT}-->"/></td>
					</tr>
					<tr>
						<td>密码：</td><td><input type="text" name="dbpass" class="input-text" value="<!--{$smarty.const.DBPASS}-->"/></td>
					</tr>
					<tr>
						<td>数据库：</td><td><input type="text" name="dbname" class="input-text" value="<!--{$smarty.const.DBNAME}-->"/></td>
					</tr>
					<tr>
						<td>更新时间：</td><td><font color="red"><!--{$uptime}--></font></td>
					</tr>
					<tr>
						<td></td><td><input type="submit" value="切换数据库" class="butt" onclick="cgdb();"/>&nbsp;&nbsp;&nbsp;<input type="submit" value="创建表结构" onclick="createtb();" class="butt"/></td>
					</tr>
				</table>
			</form>
			<div class="clear"></div>
		</div>
		<div class="infolist">
			<ul><li>时间</li><li>表</li><li>结果</li></ul>
		</div>
	</div>
</body>
<script>
	function cgdb()
	{
		if(confirm('切换数据库可能会造成系统不稳定，是否切换数据库？'))
		{
			$.ajax({
			   type: "POST",
			   url: "admins_ajax.php",
			   data: 'action=cgdb&'+$("form").serialize(),
			   success: function(msg){msg=='OK'?location.reload():alert(msg);}
			});
		}
	}
	function createtb()
	{
		if(confirm('创建表结构会清除原有表数据，是否创建？'))
		{
			$.ajax({
			   type: "POST",
			   url: "admins_ajax.php",
			   data: 'action=createtb&'+$("form").serialize(),
			   success: function(msg){msg=='OK'?location.reload():alert(msg);}
			});
		}
	}
</script>
</html>